package version

import (
    "bytes"
    "fmt"
    "gitee.com/clearluo/gotools/util"
)

const (
    Development = "development"
    Production  = "production"
)

var (
    buildTime   = ""
    commitID    = ""
    version     = "0.0"
    Environment = Production //

    Remark = ""

    isDevelopment = false
)
func init() {
    isDevelopment = Environment != Production
}

func PrintVersion() string {
    buf := bytes.Buffer{}
    buf.WriteString("\n**************************************\n")
    buf.WriteString(fmt.Sprintf("Version:%v\n", version))
    buf.WriteString(fmt.Sprintf("Environment:%v\n", Environment))
    buf.WriteString(fmt.Sprintf("IsDevelopment:%v\n", isDevelopment))
    buf.WriteString(fmt.Sprintf("BuildTime:%v\n", buildTime))
    buf.WriteString(fmt.Sprintf("RunDir:%v\n",util.GetBinDirNew()))
    buf.WriteString(fmt.Sprintf("Remark:%v\n", Remark))
    buf.WriteString("**************************************\n")
    return buf.String()
}

func IsDevelopment() bool {
    return isDevelopment
}